class CreatePaths < ActiveRecord::Migration
    def self.up
        create_table "paths", :force => true do |t|
            t.column "title", :string, :limit => 100, :null => false
            t.column "user_id", :int
            t.column "published", :boolean
            t.column "created_at", :datetime
            t.column "updated_at", :datetime
        end
        
        add_index :paths, :user_id
        execute "ALTER TABLE paths ADD CONSTRAINT paths_user_id_fkey FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE ON UPDATE CASCADE"
    end
    
    def self.down
        drop_table :paths
    end
end
